package com.zqx.kafkaproject.kafkademo.utils;

import java.util.Random;

/**
 * title:key工具类
 * @author zqx
 * @date 2018.07.27
 */
public class KeyUtil {

    /**
     * 生成唯一的主键或业务id
     * 格式: 时间+随机数
     * @return
     */
    public static synchronized Long genUniqueKey() {
        Random random = new Random();
        Integer number = random.nextInt(900000) + 100000;
        return System.currentTimeMillis() + number;
    }
}
